/*
 * Teste_vocacionalView.java
 *  @author Luciano Carrafa Benfica.
 */

package teste_vocacional;

import org.jdesktop.application.Action;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
import org.jdesktop.application.FrameView;
import org.jdesktop.application.TaskMonitor;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.Calendar;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.Timer;
import javax.swing.Icon;
import javax.swing.JDialog;
import javax.swing.JFrame;
import teste_vocacional.classes.ClassConecta;


/**
 * The application's main frame.
 */
public class Teste_vocacionalView extends FrameView {

    public Teste_vocacionalView(SingleFrameApplication app) {
        super(app);

        initComponents();

        ActionListener tarefa = (new ActionListener(){
        public void actionPerformed(ActionEvent e){
        HORAS();
        }
        });

        javax.swing.Timer time = new javax.swing.Timer(1000,tarefa);
        time.start();

        iniciaContadorUsuariosjButtonActionPerformed(null);


        // status bar initialization - message timeout, idle icon and busy animation, etc
        ResourceMap resourceMap = getResourceMap();
        int messageTimeout = resourceMap.getInteger("StatusBar.messageTimeout");
        messageTimer = new Timer(messageTimeout, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                statusMessageLabel.setText("");
            }
        });
        messageTimer.setRepeats(false);
        int busyAnimationRate = resourceMap.getInteger("StatusBar.busyAnimationRate");
        for (int i = 0; i < busyIcons.length; i++) {
            busyIcons[i] = resourceMap.getIcon("StatusBar.busyIcons[" + i + "]");
        }
        busyIconTimer = new Timer(busyAnimationRate, new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                busyIconIndex = (busyIconIndex + 1) % busyIcons.length;
                statusAnimationLabel.setIcon(busyIcons[busyIconIndex]);
            }
        });
        idleIcon = resourceMap.getIcon("StatusBar.idleIcon");
        statusAnimationLabel.setIcon(idleIcon);
        progressBar.setVisible(false);

        // connecting action tasks to status bar via TaskMonitor
        TaskMonitor taskMonitor = new TaskMonitor(getApplication().getContext());
        taskMonitor.addPropertyChangeListener(new java.beans.PropertyChangeListener() {
            @Override
            public void propertyChange(java.beans.PropertyChangeEvent evt) {
                String propertyName = evt.getPropertyName();
                switch (propertyName) {
                    case "started":
                        if (!busyIconTimer.isRunning()) {
                            statusAnimationLabel.setIcon(busyIcons[0]);
                            busyIconIndex = 0;
                            busyIconTimer.start();
                        }
                        progressBar.setVisible(true);
                        progressBar.setIndeterminate(true);
                        break;
                    case "done":
                        busyIconTimer.stop();
                        statusAnimationLabel.setIcon(idleIcon);
                        progressBar.setVisible(false);
                        progressBar.setValue(0);
                        break;
                    case "message":
                        String text = (String) (evt.getNewValue());
                        statusMessageLabel.setText((text == null) ? "" : text);
                        messageTimer.restart();
                        break;
                    case "progress":
                        int value = (Integer) (evt.getNewValue());
                        progressBar.setVisible(true);
                        progressBar.setIndeterminate(false);
                        progressBar.setValue(value);
                        break;
                }
            }
        });
    }

    @Action
    public void showAboutBox() {
        if (aboutBox == null) {
            JFrame mainFrame = Teste_vocacionalApp.getApplication().getMainFrame();
            aboutBox = new Teste_vocacionalAboutBox(mainFrame);
            aboutBox.setLocationRelativeTo(mainFrame);
        }
        Teste_vocacionalApp.getApplication().show(aboutBox);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        mainPanel = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        cadastrojButton = new javax.swing.JButton();
        cadastroVocacaojButton = new javax.swing.JButton();
        cadastroPerguntasjButton = new javax.swing.JButton();
        alternativasjButton = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jButton1 = new javax.swing.JButton();
        horajLabel = new javax.swing.JLabel();
        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        totalParticipantesjLabel = new javax.swing.JLabel();
        iniciaContadorUsuariosjButton = new javax.swing.JButton();
        iniciarTestejButton = new javax.swing.JButton();
        menuBar = new javax.swing.JMenuBar();
        javax.swing.JMenu fileMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem exitMenuItem = new javax.swing.JMenuItem();
        cadastrosjMenu = new javax.swing.JMenu();
        empresajMenuItem = new javax.swing.JMenuItem();
        cadastroVocacaojMenuItem = new javax.swing.JMenuItem();
        cadastroPerguntasjMenuItem = new javax.swing.JMenuItem();
        jMenuItem1 = new javax.swing.JMenuItem();
        relatoriosjMenu = new javax.swing.JMenu();
        relatoriosjMenuItem = new javax.swing.JMenuItem();
        javax.swing.JMenu helpMenu = new javax.swing.JMenu();
        javax.swing.JMenuItem aboutMenuItem = new javax.swing.JMenuItem();
        statusPanel = new javax.swing.JPanel();
        javax.swing.JSeparator statusPanelSeparator = new javax.swing.JSeparator();
        statusMessageLabel = new javax.swing.JLabel();
        statusAnimationLabel = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();

        org.jdesktop.application.ResourceMap resourceMap = org.jdesktop.application.Application.getInstance(teste_vocacional.Teste_vocacionalApp.class).getContext().getResourceMap(Teste_vocacionalView.class);
        mainPanel.setBackground(resourceMap.getColor("mainPanel.background")); // NOI18N
        mainPanel.setName("mainPanel"); // NOI18N

        jToolBar1.setBackground(resourceMap.getColor("jToolBar1.background")); // NOI18N
        jToolBar1.setFloatable(false);
        jToolBar1.setRollover(true);
        jToolBar1.setName("jToolBar1"); // NOI18N

        cadastrojButton.setBackground(resourceMap.getColor("cadastrojButton.background")); // NOI18N
        cadastrojButton.setIcon(resourceMap.getIcon("cadastrojButton.icon")); // NOI18N
        cadastrojButton.setText(resourceMap.getString("cadastrojButton.text")); // NOI18N
        cadastrojButton.setToolTipText(resourceMap.getString("cadastrojButton.toolTipText")); // NOI18N
        cadastrojButton.setFocusable(false);
        cadastrojButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cadastrojButton.setName("cadastrojButton"); // NOI18N
        cadastrojButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cadastrojButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastrojButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(cadastrojButton);

        cadastroVocacaojButton.setBackground(resourceMap.getColor("cadastroVocacaojButton.background")); // NOI18N
        cadastroVocacaojButton.setIcon(resourceMap.getIcon("cadastroVocacaojButton.icon")); // NOI18N
        cadastroVocacaojButton.setText(resourceMap.getString("cadastroVocacaojButton.text")); // NOI18N
        cadastroVocacaojButton.setToolTipText(resourceMap.getString("cadastroVocacaojButton.toolTipText")); // NOI18N
        cadastroVocacaojButton.setFocusable(false);
        cadastroVocacaojButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cadastroVocacaojButton.setName("cadastroVocacaojButton"); // NOI18N
        cadastroVocacaojButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cadastroVocacaojButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroVocacaojButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(cadastroVocacaojButton);

        cadastroPerguntasjButton.setBackground(resourceMap.getColor("cadastroPerguntasjButton.background")); // NOI18N
        cadastroPerguntasjButton.setIcon(resourceMap.getIcon("cadastroPerguntasjButton.icon")); // NOI18N
        cadastroPerguntasjButton.setText(resourceMap.getString("cadastroPerguntasjButton.text")); // NOI18N
        cadastroPerguntasjButton.setToolTipText(resourceMap.getString("cadastroPerguntasjButton.toolTipText")); // NOI18N
        cadastroPerguntasjButton.setFocusable(false);
        cadastroPerguntasjButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        cadastroPerguntasjButton.setName("cadastroPerguntasjButton"); // NOI18N
        cadastroPerguntasjButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        cadastroPerguntasjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroPerguntasjButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(cadastroPerguntasjButton);

        alternativasjButton.setBackground(resourceMap.getColor("alternativasjButton.background")); // NOI18N
        alternativasjButton.setIcon(resourceMap.getIcon("alternativasjButton.icon")); // NOI18N
        alternativasjButton.setText(resourceMap.getString("alternativasjButton.text")); // NOI18N
        alternativasjButton.setToolTipText(resourceMap.getString("alternativasjButton.toolTipText")); // NOI18N
        alternativasjButton.setFocusable(false);
        alternativasjButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        alternativasjButton.setName("alternativasjButton"); // NOI18N
        alternativasjButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        alternativasjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                alternativasjButtonActionPerformed(evt);
            }
        });
        jToolBar1.add(alternativasjButton);

        jSeparator1.setName("jSeparator1"); // NOI18N
        jToolBar1.add(jSeparator1);

        jButton1.setBackground(resourceMap.getColor("jButton1.background")); // NOI18N
        jButton1.setIcon(resourceMap.getIcon("jButton1.icon")); // NOI18N
        jButton1.setText(resourceMap.getString("jButton1.text")); // NOI18N
        jButton1.setToolTipText(resourceMap.getString("jButton1.toolTipText")); // NOI18N
        jButton1.setFocusable(false);
        jButton1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton1.setName("jButton1"); // NOI18N
        jButton1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });
        jToolBar1.add(jButton1);

        horajLabel.setFont(resourceMap.getFont("horajLabel.font")); // NOI18N
        horajLabel.setText(resourceMap.getString("horajLabel.text")); // NOI18N
        horajLabel.setName("horajLabel"); // NOI18N

        jPanel1.setBackground(resourceMap.getColor("jPanel1.background")); // NOI18N
        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder(""));
        jPanel1.setName("jPanel1"); // NOI18N

        jLabel1.setText(resourceMap.getString("jLabel1.text")); // NOI18N
        jLabel1.setName("jLabel1"); // NOI18N

        totalParticipantesjLabel.setText(resourceMap.getString("totalParticipantesjLabel.text")); // NOI18N
        totalParticipantesjLabel.setName("totalParticipantesjLabel"); // NOI18N

        iniciaContadorUsuariosjButton.setText(resourceMap.getString("iniciaContadorUsuariosjButton.text")); // NOI18N
        iniciaContadorUsuariosjButton.setContentAreaFilled(false);
        iniciaContadorUsuariosjButton.setFocusable(false);
        iniciaContadorUsuariosjButton.setName("iniciaContadorUsuariosjButton"); // NOI18N
        iniciaContadorUsuariosjButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                iniciaContadorUsuariosjButtonActionPerformed(evt);
            }
        });

        iniciarTestejButton.setText(resourceMap.getString("iniciarTestejButton.text")); // NOI18N
        iniciarTestejButton.setName("iniciarTestejButton"); // NOI18N
        iniciarTestejButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                iniciarTestejButtonActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jLabel1)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(totalParticipantesjLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 29, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(iniciaContadorUsuariosjButton))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(21, 21, 21)
                        .addComponent(iniciarTestejButton, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(162, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(totalParticipantesjLabel)
                    .addComponent(iniciaContadorUsuariosjButton, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 41, Short.MAX_VALUE)
                .addComponent(iniciarTestejButton)
                .addContainerGap())
        );

        javax.swing.GroupLayout mainPanelLayout = new javax.swing.GroupLayout(mainPanel);
        mainPanel.setLayout(mainPanelLayout);
        mainPanelLayout.setHorizontalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 48, Short.MAX_VALUE)
                .addComponent(horajLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 109, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
        );
        mainPanelLayout.setVerticalGroup(
            mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(mainPanelLayout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(mainPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(horajLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(275, 275, 275))
        );

        menuBar.setName("menuBar"); // NOI18N

        fileMenu.setText(resourceMap.getString("fileMenu.text")); // NOI18N
        fileMenu.setName("fileMenu"); // NOI18N

        javax.swing.ActionMap actionMap = org.jdesktop.application.Application.getInstance(teste_vocacional.Teste_vocacionalApp.class).getContext().getActionMap(Teste_vocacionalView.class, this);
        exitMenuItem.setAction(actionMap.get("quit")); // NOI18N
        exitMenuItem.setText(resourceMap.getString("exitMenuItem.text")); // NOI18N
        exitMenuItem.setName("exitMenuItem"); // NOI18N
        fileMenu.add(exitMenuItem);

        menuBar.add(fileMenu);

        cadastrosjMenu.setText(resourceMap.getString("cadastrosjMenu.text")); // NOI18N
        cadastrosjMenu.setName("cadastrosjMenu"); // NOI18N

        empresajMenuItem.setText(resourceMap.getString("empresajMenuItem.text")); // NOI18N
        empresajMenuItem.setName("empresajMenuItem"); // NOI18N
        empresajMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                empresajMenuItemActionPerformed(evt);
            }
        });
        cadastrosjMenu.add(empresajMenuItem);

        cadastroVocacaojMenuItem.setText(resourceMap.getString("cadastroVocacaojMenuItem.text")); // NOI18N
        cadastroVocacaojMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroVocacaojMenuItemActionPerformed(evt);
            }
        });
        cadastrosjMenu.add(cadastroVocacaojMenuItem);

        cadastroPerguntasjMenuItem.setText(resourceMap.getString("cadastroPerguntasjMenuItem.text")); // NOI18N
        cadastroPerguntasjMenuItem.setName("cadastroPerguntasjMenuItem"); // NOI18N
        cadastroPerguntasjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cadastroPerguntasjMenuItemActionPerformed(evt);
            }
        });
        cadastrosjMenu.add(cadastroPerguntasjMenuItem);

        jMenuItem1.setText(resourceMap.getString("jMenuItem1.text")); // NOI18N
        jMenuItem1.setName("jMenuItem1"); // NOI18N
        jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem1ActionPerformed(evt);
            }
        });
        cadastrosjMenu.add(jMenuItem1);

        menuBar.add(cadastrosjMenu);

        relatoriosjMenu.setText(resourceMap.getString("relatoriosjMenu.text")); // NOI18N
        relatoriosjMenu.setName("relatoriosjMenu"); // NOI18N
        relatoriosjMenu.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                relatoriosjMenuActionPerformed(evt);
            }
        });

        relatoriosjMenuItem.setText(resourceMap.getString("relatoriosjMenuItem.text")); // NOI18N
        relatoriosjMenuItem.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                relatoriosjMenuItemActionPerformed1(evt);
            }
        });
        relatoriosjMenu.add(relatoriosjMenuItem);

        menuBar.add(relatoriosjMenu);

        helpMenu.setText(resourceMap.getString("helpMenu.text")); // NOI18N
        helpMenu.setName("helpMenu"); // NOI18N

        aboutMenuItem.setAction(actionMap.get("showAboutBox")); // NOI18N
        aboutMenuItem.setText(resourceMap.getString("aboutMenuItem.text")); // NOI18N
        aboutMenuItem.setName("aboutMenuItem"); // NOI18N
        helpMenu.add(aboutMenuItem);

        menuBar.add(helpMenu);

        statusPanel.setName("statusPanel"); // NOI18N

        statusPanelSeparator.setName("statusPanelSeparator"); // NOI18N

        statusMessageLabel.setName("statusMessageLabel"); // NOI18N

        statusAnimationLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        statusAnimationLabel.setName("statusAnimationLabel"); // NOI18N

        progressBar.setName("progressBar"); // NOI18N

        javax.swing.GroupLayout statusPanelLayout = new javax.swing.GroupLayout(statusPanel);
        statusPanel.setLayout(statusPanelLayout);
        statusPanelLayout.setHorizontalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(statusPanelSeparator, javax.swing.GroupLayout.DEFAULT_SIZE, 647, Short.MAX_VALUE)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(statusMessageLabel)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 477, Short.MAX_VALUE)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(statusAnimationLabel)
                .addContainerGap())
        );
        statusPanelLayout.setVerticalGroup(
            statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(statusPanelLayout.createSequentialGroup()
                .addComponent(statusPanelSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(statusPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(statusMessageLabel)
                    .addComponent(statusAnimationLabel)
                    .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3))
        );

        setComponent(mainPanel);
        setMenuBar(menuBar);
        setStatusBar(statusPanel);
    }// </editor-fold>//GEN-END:initComponents

    

    int hh,mm,ss,h;
Calendar CalendarHora;
DecimalFormat formato;

private void HORAS(){
CalendarHora = Calendar.getInstance();
hh = CalendarHora.get(Calendar.HOUR_OF_DAY);
mm = CalendarHora.get(Calendar.MINUTE);
ss = CalendarHora.get(Calendar.SECOND);
formato = new DecimalFormat("00");
horajLabel.setText("Hora: "+formatar(hh)+":"+formatar(mm)+":"+formatar(ss));
//horajLabel.setText("Hora: "+formatar(hh%12)+":"+formatar(mm)+":"+formatar(ss)); <<== Usar este modelo quando quizer horario (am - pm)
}

public String formatar(int num){
formato = new DecimalFormat("00");
return formato.format(num);
}

    public int totalParticipante = 0;


    ClassConecta conexao = new ClassConecta();




    private void empresajMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_empresajMenuItemActionPerformed
        // TODO add your handling code here:
        jFEmpresas oEmpresa = new jFEmpresas();

        oEmpresa.setDefaultCloseOperation(jFEmpresas.DO_NOTHING_ON_CLOSE);
        oEmpresa.pack();
        oEmpresa.setLocationRelativeTo(null);
        oEmpresa.setVisible(true);
    }//GEN-LAST:event_empresajMenuItemActionPerformed

    private void cadastroVocacaojMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroVocacaojMenuItemActionPerformed
        // TODO add your handling code here:
        jFVocacoes oFormVocacao = new jFVocacoes();

        oFormVocacao.setDefaultCloseOperation(jFVocacoes.DO_NOTHING_ON_CLOSE);
        oFormVocacao.pack();
        oFormVocacao.setLocationRelativeTo(null);
        oFormVocacao.setVisible(true);
    }//GEN-LAST:event_cadastroVocacaojMenuItemActionPerformed

    private void cadastroPerguntasjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroPerguntasjMenuItemActionPerformed
        // TODO add your handling code here:
        jFPerguntas oFormPerguntas = new jFPerguntas();

        oFormPerguntas.setDefaultCloseOperation(jFPerguntas.DO_NOTHING_ON_CLOSE);
        oFormPerguntas.pack();
        oFormPerguntas.setLocationRelativeTo(null);
        oFormPerguntas.setVisible(true);
    }//GEN-LAST:event_cadastroPerguntasjMenuItemActionPerformed

    private void iniciarTestejButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_iniciarTestejButtonActionPerformed
        // TODO add your handling code here:
        jFResposta oFormResposta = new jFResposta();

        oFormResposta.setDefaultCloseOperation(jFVocacoes.DO_NOTHING_ON_CLOSE);
        oFormResposta.pack();
        oFormResposta.setLocationRelativeTo(null);
        oFormResposta.setVisible(true);
    }//GEN-LAST:event_iniciarTestejButtonActionPerformed

    private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
        // TODO add your handling code here:
        jFAlternativas oFormAlternativa = new jFAlternativas();

        oFormAlternativa.setDefaultCloseOperation(jFAlternativas.DO_NOTHING_ON_CLOSE);
        oFormAlternativa.pack();
        oFormAlternativa.setLocationRelativeTo(null);
        oFormAlternativa.setVisible(true);
    }//GEN-LAST:event_jMenuItem1ActionPerformed

    private void relatoriosjMenuItemActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relatoriosjMenuItemActionPerformed
        // TODO add your handling code here:
       
    }//GEN-LAST:event_relatoriosjMenuItemActionPerformed

    private void relatoriosjMenuItemActionPerformed1(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relatoriosjMenuItemActionPerformed1
        // TODO add your handling code here:
        jFParticipantes oFormParticipante = new jFParticipantes();

        oFormParticipante.setDefaultCloseOperation(jFParticipantes.DO_NOTHING_ON_CLOSE);
        oFormParticipante.pack();
        oFormParticipante.setLocationRelativeTo(null);
        oFormParticipante.setVisible(true);
    }//GEN-LAST:event_relatoriosjMenuItemActionPerformed1

    private void relatoriosjMenuActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_relatoriosjMenuActionPerformed
        // TODO add your handling code here:

    }//GEN-LAST:event_relatoriosjMenuActionPerformed

    private void cadastrojButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastrojButtonActionPerformed
        // TODO add your handling code here:
        jFEmpresas oEmpresa = new jFEmpresas();

        oEmpresa.setDefaultCloseOperation(jFEmpresas.DO_NOTHING_ON_CLOSE);
        oEmpresa.pack();
        oEmpresa.setLocationRelativeTo(null);
        oEmpresa.setVisible(true);
    }//GEN-LAST:event_cadastrojButtonActionPerformed

    private void cadastroVocacaojButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroVocacaojButtonActionPerformed
        // TODO add your handling code here:
        jFVocacoes oFormVocacao = new jFVocacoes();

        oFormVocacao.setDefaultCloseOperation(jFVocacoes.DO_NOTHING_ON_CLOSE);
        oFormVocacao.pack();
        oFormVocacao.setLocationRelativeTo(null);
        oFormVocacao.setVisible(true);
    }//GEN-LAST:event_cadastroVocacaojButtonActionPerformed

    private void cadastroPerguntasjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cadastroPerguntasjButtonActionPerformed
        // TODO add your handling code here:
        jFPerguntas oFormPerguntas = new jFPerguntas();

        oFormPerguntas.setDefaultCloseOperation(jFPerguntas.DO_NOTHING_ON_CLOSE);
        oFormPerguntas.pack();
        oFormPerguntas.setLocationRelativeTo(null);
        oFormPerguntas.setVisible(true);
    }//GEN-LAST:event_cadastroPerguntasjButtonActionPerformed

    private void alternativasjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_alternativasjButtonActionPerformed
        // TODO add your handling code here:
        jFAlternativas oFormAlternativa = new jFAlternativas();

        oFormAlternativa.setDefaultCloseOperation(jFAlternativas.DO_NOTHING_ON_CLOSE);
        oFormAlternativa.pack();
        oFormAlternativa.setLocationRelativeTo(null);
        oFormAlternativa.setVisible(true);
    }//GEN-LAST:event_alternativasjButtonActionPerformed

    private void iniciaContadorUsuariosjButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_iniciaContadorUsuariosjButtonActionPerformed
        // TODO add your handling code here:

        ClassConecta.conecta();
        Participantes oParticipante = new Participantes();
        try {
            totalParticipante = Integer.parseInt(oParticipante.getQuantidadeParticipante().toString());
        } catch (SQLException ex) {
            Logger.getLogger(jFParticipantes.class.getName()).log(Level.SEVERE, null, ex);
        }
        totalParticipantesjLabel.setText(String.valueOf(totalParticipante));

    }//GEN-LAST:event_iniciaContadorUsuariosjButtonActionPerformed

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        System.exit(0);
    }//GEN-LAST:event_jButton1ActionPerformed

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton alternativasjButton;
    private javax.swing.JButton cadastroPerguntasjButton;
    private javax.swing.JMenuItem cadastroPerguntasjMenuItem;
    private javax.swing.JButton cadastroVocacaojButton;
    private javax.swing.JMenuItem cadastroVocacaojMenuItem;
    private javax.swing.JButton cadastrojButton;
    private javax.swing.JMenu cadastrosjMenu;
    private javax.swing.JMenuItem empresajMenuItem;
    private javax.swing.JLabel horajLabel;
    private javax.swing.JButton iniciaContadorUsuariosjButton;
    private javax.swing.JButton iniciarTestejButton;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JPanel mainPanel;
    private javax.swing.JMenuBar menuBar;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JMenu relatoriosjMenu;
    private javax.swing.JMenuItem relatoriosjMenuItem;
    private javax.swing.JLabel statusAnimationLabel;
    private javax.swing.JLabel statusMessageLabel;
    private javax.swing.JPanel statusPanel;
    private javax.swing.JLabel totalParticipantesjLabel;
    // End of variables declaration//GEN-END:variables

    private final Timer messageTimer;
    private final Timer busyIconTimer;
    private final Icon idleIcon;
    private final Icon[] busyIcons = new Icon[15];
    private int busyIconIndex = 0;

    private JDialog aboutBox;
}
